package com.ruoyi.system.domain.HUAWEI;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.system.domain.MES.DataCollection;
import com.ruoyi.system.domain.MES.DataCollectionInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * @author GE-LV5
 * @create 2023/4/10 15:47
 */
@Data
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Accessors(chain = true)
@TableName("EMS_BARCODE_ATTRIBUTE")
public class EmsBarcodeAttribute implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "2位EMS代码+8位年月日+流水号")
    @Excel(name = "客户类型")
    private String emsTransId;

    @ApiModelProperty(value = "非能源默认157")
    @Excel(name = "非能源默认157")
    private Integer organizationId;

    @ApiModelProperty(value = "任务令")
    @Excel(name = "任务令")
    private String po;

    @ApiModelProperty(value = "产品编码")
    @Excel(name = "产品编码")
    private String itemNumber;

    @ApiModelProperty(value = "写实际打印的版本，若无版本，则为空")
    @Excel(name = "写实际打印的版本，若无版本，则为空")
    private String itemVer;

    @ApiModelProperty(value = "2位供应商代码")
    @Excel(name = "2位供应商代码")
    private String emsCode;


    @ApiModelProperty(value = "供应商编码")
    @Excel(name = "供应商编码")
    private Integer vendorId;

    @ApiModelProperty(value = "产品SN")
    @Excel(name = "产品SN")
    private String sn;

    @ApiModelProperty(value = "产品二维条码")
    @Excel(name = "产品二维条码")
    private String barcodeQr;

    @ApiModelProperty(value = "产品加工原产地CHINA填写CN")
    @Excel(name = "产品加工原产地CHINA填写CN")
    private String coo;

    /**
     * updatedBy
     */
    @ApiModelProperty(value = "数制回传人名字及工号")
    @Excel(name = "数制回传人名字及工号")
    private String updatedBy;


    /**
     * 回传时间（秒级）
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "回传时间（秒级）")
    @Excel(name = "回传时间（秒级）")
    private Date updatedDate;

    /**
     * createdDate
     */
    @Excel(name = "产品SN打印时间", width = 30, dateFormat = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "产品条码打印时间")
    private Date createdDate;

    @ApiModelProperty(value = "打印人名字及工号")
    @Excel(name = "打印人名字及工号")
    private String createdBy;

    @ApiModelProperty(value = "attribute1")
    @Excel(name = "attribute1")
    private String attribute1;

    @ApiModelProperty(value = "attribute2")
    @Excel(name = "attribute2")
    private String attribute2;

    @ApiModelProperty(value = "attribute3")
    @Excel(name = "attribute3")
    private String attribute3;

    @ApiModelProperty(value = "attribute4")
    @Excel(name = "attribute4")
    private String attribute4;

    @ApiModelProperty(value = "attribute5")
    @Excel(name = "attribute5")
    private String attribute5;

    @ApiModelProperty(value = "segment1")
    @Excel(name = "segment1")
    private String segment1;

    @ApiModelProperty(value = "segment2")
    @Excel(name = "segment2")
    private String segment2;

    @ApiModelProperty(value = "segment3")
    @Excel(name = "segment3")
    private String segment3;

    @ApiModelProperty(value = "segment4")
    @Excel(name = "segment4")
    private String segment4;

    @ApiModelProperty(value = "segment5")
    @Excel(name = "segment5")
    private String segment5;

    /**
     * uploadFlag
     */
    @ApiModelProperty(value = "uploadFlag")
    @Excel(name = "uploadFlag")
    private Integer uploadFlag;

    /**
     * checkMessage
     */
    @ApiModelProperty(value = "checkMessage")
    @Excel(name = "checkMessage")
    private String checkMessage;

    /**
     * checkMessage
     */
    @ApiModelProperty(value = "type")
    @Excel(name = "type")
    private String type;

    /**
     * roshFlag
     */
    @ApiModelProperty(value = "roshFlag")
    @Excel(name = "roshFlag")
    private String roshFlag;

    /**
     * 回传结果
     */
    @ApiModelProperty(value = "回传结果")
    private String res;

    @ApiModelProperty(value = "采集开始时间")
    @Excel(name = "采集开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(exist = false)
    private Date beginTime;

    @ApiModelProperty(value = "采集结束时间")
    @Excel(name = "采集结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(exist = false)
    private Date endTime;

    public EmsBarcodeAttribute(DataCollection ction){
        this.organizationId = 157;
        this.itemNumber = ction.getFProdCodeNo();
        this.emsCode = "H4";
        this.vendorId = 22827731;
        this.sn = ction.getFNumber();
        this.updatedDate = new Date();
        this.createdDate = DateUtil.parse(ction.getFDate(),"yyyy-MM-dd HH:mm:ss");
        this.segment1 = "1";
        this.segment2 = "1D";
        this.roshFlag = "Y";
    }
}

